<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<fmt:setBundle basename="ApplicationResources" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><fmt:message key="title.presenterProducer" /></title>
<script>
function checkRPSelected(name) {
	var radios = document.getElementsByName(name);
	for (var i = 0; i < radios.length; i++) {
	    if (radios[i].type === 'radio' && radios[i].checked) {
	        // get value, set checked flag or do whatever you need to
	       //return radios[i].id;
	       var id1 = self.opener.document.getElementById('presenterId').value;
	       var id2 = self.opener.document.getElementById('presenterLabel').value;
	       self.opener.document.getElementById(id1).value = radios[i].id;
	       self.opener.document.getElementById(id2).value = radios[i].value;
	    }
	}
}

</script>
<%
String roleid=(String)request.getAttribute("roleId");

%>
</head>
<body>
	<h2>
	<input type="hidden" value=<%=roleid %>>
	<%if (roleid != null && roleid.equals("2")){ %>
		<fmt:message key="title.presenter" />
		<%} else {%>
		<fmt:message key="title.producer" />
		<%} %>
	</h2>
	<form action="${pageContext.request.contextPath}/controller/searchPP"
		method=post>
		<center>
			<table class="framed">
				<tr>
					<th width="45%"></th>
				</tr>
				<tr>
					<td>
					<%if (roleid != null && roleid.equals("2")){ %>
					<fmt:message key="fieldLabel.searchPresenter" />
					<%} else {%>
					<fmt:message key="fieldLabel.searchProducer" />
					<%} %>
					</td>
					<td><input type="text" name="name" size=45 maxlength=45></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><input type="submit" value="Submit"> <input
						type="reset" value="Reset"></td>
				</tr>
			</table>
		</center>
	</form>
	<c:if test="${! empty  searchppdata}">
		<table class="borderAll">
			<tr>
				<td>
					<c:choose>
						<c:when test="${not empty ppnotFound}">
							<p class="errorMessage">${ppnotFound}</p>
						</c:when>
					</c:choose>
				</td>
				<td></td>
			</tr>
			<tr>
				<th><fmt:message key="label.user.nameSPP" /></th>
				<th><fmt:message key="label.user.countrySPP" /></th>
			</tr>
			<c:forEach var="rprogram" items="${searchppdata}" varStatus="status">
				<tr class="${status.index%2==0?'even':'odd'}">
					<td class="nowrap">${rprogram.name}</td>
					<td class="nowrap">${rprogram.country}</td>
					<td> <input onclick="checkRPSelected('user_name')" type="radio" name="user_name" id="${rprogram.name}" value="${rprogram.name}"></td>
					
				</tr>
			</c:forEach>
		</table>
		<input type="text" name="textbox1" size=45 maxlength=45>
	</c:if>
	
</body>
</html>